import { RouteRecordRaw } from 'vue-router';
import { LOGIN, MAP, ROUTE_403, ROUTE_404, UPLOAD } from './route-name';
// import BasicLayout from '@/layout/basic-layout/BasicLayout.vue';

declare module 'vue-router' {
  interface RouteMeta {
    // 是可选的
    isAdmin?: boolean;
    // 每个路由都必须声明
    requiresAuth: boolean;
  }
}
// 静态路由
const staticRoutes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/login',
  },

  // 登录页 以及注册页
  {
    path: '/login',
    name: LOGIN,
    component: () => import('@/views/login/LoginContainer.vue'),
    meta: {
      requiresAuth: false,
    },
  },

  {
    path: '/map',
    name: MAP,
    component: () => import('@/views/map/MapContainer.vue'),
    meta: {
      requiresAuth: true,
    },
  },

  {
    path: '/uplaod',
    name: UPLOAD,
    component: () => import('@/views/pick/PickContainer.vue'),
    meta: {
      requiresAuth: true,
    },
  },

  //  404
  {
    path: '/404',
    name: ROUTE_404,
    component: () => import('@/views/tips/NotFoundPage.vue'),
    meta: {
      requiresAuth: false,
    },
  },

  {
    path: '/403',
    name: ROUTE_403,
    component: () => import('@/views/tips/NotAuthPage.vue'),
    meta: {
      requiresAuth: false,
    },
  },
];

export default staticRoutes;
